package com.sunny.ynhz.ui;

import android.animation.ValueAnimator;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;

import com.sunny.ynhz.R;
import com.sunny.ynhz.ui.base.AppBaseTitleBarActivity;

/**
 * Created by huhuan123 on 2018/5/23.
 */

public class TestScorllActivity extends AppBaseTitleBarActivity {
    private int i=0;
    Handler handler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            i++;
            handler.sendEmptyMessageDelayed(0,20);
           listView.smoothScrollBy(3,0);
        }
    };
    private ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test_scroll_view);
        listView = findViewById(R.id.lv);
        listView.setAdapter(new MyAdapter());
        handler.sendEmptyMessage(0);
    }

    class MyAdapter extends BaseAdapter {

        @Override
        public int getCount() {
            return Integer.MAX_VALUE;
        }

        @Override
        public Object getItem(int i) {
            return null;
        }

        @Override
        public long getItemId(int i) {
            return 0;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            return LayoutInflater.from(TestScorllActivity.this).inflate(R.layout.item_test_child, null);
        }
    }

}
